{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<div align=\"right\"><a href=\"http://norvig.com\">Peter Norvig</a><br><a href=\"https://github.com/norvig/pytudes\">pytudes</a><br>March 2019</div>\n",
    "\n",
    "# Dice Baseball\n",
    "\n",
    "The [538 Riddler for March 22, 2019](https://fivethirtyeight.com/features/can-you-turn-americas-pastime-into-a-game-of-yahtzee/) asks us to simulate baseball using probabilities from a 19th century dice game called *Our National Ball Game*:\n",
    "\n",
    "    1,1: double         2,2: strike    3,3: out at 1st  4,4: fly out\n",
    "    1,2: single         2,3: strike    3,4: out at 1st  4,5: fly out\n",
    "    1,3: single         2,4: strike    3,5: out at 1st  4,6: fly out\n",
    "    1,4: single         2,5: strike    3,6: out at 1st  5,5: double play\n",
    "    1,5: base on error  2,6: foul out                   5,6: triple\n",
    "    1,6: base on balls                                  6,6: home run\n",
    "\n",
    "\n",
    "The rules left some things unspecified; the following are my current choices (in an early version I made different choices that resulted in slightly more runs):\n",
    "\n",
    "* On a*&nbsp;b*-base hit, runners advance*&nbsp;b* bases, except that a runner on second scores on a 1-base hit.\n",
    "* On an \"out at first\", all runners advance one base.\n",
    "* A double play only applies if there is a runner on first; in that case other runners advance.\n",
    "* On a fly out, a runner on third scores; other runners do not advance.\n",
    "* On an error all runners advance one base. \n",
    "* On a base on balls, only forced runners advance.\n",
    "\n",
    "I also made some choices about the implementation:\n",
    "\n",
    "- Exactly one outcome happens to each batter. We call that an *event*.\n",
    "- I'll represent events with the following one letter codes:\n",
    "  - `K`, `O`, `o`, `f`, `D`: strikeout, foul out, out at first, fly out, double play\n",
    "  - `1`, `2`, `3`, `4`: single, double, triple, home run\n",
    "  - `E`, `B`: error, base on balls\n",
    "- Note the \"strike\" dice roll is not an event; it is only part of an event. From the probability of a \"strike\" dice roll, I compute the probability of three strikes in a row, and call that a strikeout event. Sice there are 7 dice rolls giving \"strike\", the probability of a strike is 7/36, and the probability of a strikeout is (7/36)**3.\n",
    "- Note that a die roll such as `1,1` is a 1/36 event, whereas `1,2` is a 2/36 event, because it also represents (2, 1).\n",
    "- I'll keep track of runners with a list of occupied bases; `runners = [1, 2]` means runners on first and second.\n",
    "- A runner who advances to base 4 or higher has scored a run (unless there are already 3 outs).\n",
    "- The function `inning` simulates a half inning and returns the number of runs scored.\n",
    "- I want to be able to test `inning` by feeding it specific events, and I also want to generate random innings. So I'll make the interface be that I pass in an *iterable* of events. The function `event_stream` generates an endless stream of randomly sampled events.\n",
    "- Note that it is consider good Pythonic style to automatically convert Booleans to integers, so for a runner on second (`r = 2`) when the event is a single (`e = '1'`), the expression `r + int(e) + (r == 2)` evaluates to `2 + 1 + 1` or `4`, meaning the runner on second scores.\n",
    "- I'll play 1 million innings and store the resulting scores in `innings`.\n",
    "- To simulate a game I just sample 9 elements of `innings` and sum them.\n",
    "\n",
    "# The Code"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "import random"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "def event_stream(events='2111111EEBBOOooooooofffffD334', strike=7/36):\n",
    "    \"An iterator of random events. Defaults from `Our National Ball Game`.\"\n",
    "    while True:\n",
    "        yield 'K' if (random.random() < strike ** 3) else random.choice(events)\n",
    "        \n",
    "def inning(events=event_stream(), verbose=False) -> int:\n",
    "    \"Simulate a half inning based on events, and return number of runs scored.\"\n",
    "    outs = runs = 0 # Inning starts with no outs and no runs,\n",
    "    runners = []    # ... and with nobody on base\n",
    "    for e in events:\n",
    "        if verbose: print(f'{outs} outs, {runs} runs, event: {e}, runners: {runners}')\n",
    "        # What happens to the batter?\n",
    "        if   e in 'KOofD':  outs += 1         # Batter is out\n",
    "        elif e in '1234EB': runners.append(0) # Batter becomes a runner\n",
    "        # What happens to the runners?\n",
    "        if e == 'D' and 1 in runners: # double play: runner on 1st out, others advance\n",
    "            outs += 1\n",
    "            runners = [r + 1 for r in runners if r != 1]\n",
    "        elif e in 'oE': # out at first or error: runners advance\n",
    "            runners = [r + 1 for r in runners]\n",
    "        elif e == 'f' and 3 in runners and outs < 3: # fly out: runner on 3rd scores\n",
    "            runners.remove(3)\n",
    "            runs += 1\n",
    "        elif e in '1234': # single, double, triple, homer\n",
    "            runners = [r + int(e) + (r == 2) for r in runners]\n",
    "        elif e == 'B': # base on balls: forced runners advance \n",
    "            runners = [r + forced(runners, r) for r in runners]\n",
    "        # See if inning is over, and if not, whether anyone scored\n",
    "        if outs >= 3:\n",
    "            return runs\n",
    "        runs += sum(r >= 4 for r in runners)\n",
    "        runners = [r for r in runners if r < 4]\n",
    "        \n",
    "def forced(runners, r) -> bool: return all(b in runners for b in range(r))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Testing\n",
    "\n",
    "Let's peek at some random innings:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 outs, 0 runs, event: E, runners: []\n",
      "0 outs, 0 runs, event: 4, runners: [1]\n",
      "0 outs, 2 runs, event: E, runners: []\n",
      "0 outs, 2 runs, event: 1, runners: [1]\n",
      "0 outs, 2 runs, event: f, runners: [2, 1]\n",
      "1 outs, 2 runs, event: B, runners: [2, 1]\n",
      "1 outs, 2 runs, event: 1, runners: [3, 2, 1]\n",
      "1 outs, 4 runs, event: E, runners: [2, 1]\n",
      "1 outs, 4 runs, event: o, runners: [3, 2, 1]\n",
      "2 outs, 5 runs, event: o, runners: [3, 2]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "inning(verbose=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 outs, 0 runs, event: 1, runners: []\n",
      "0 outs, 0 runs, event: B, runners: [1]\n",
      "0 outs, 0 runs, event: O, runners: [2, 1]\n",
      "1 outs, 0 runs, event: 1, runners: [2, 1]\n",
      "1 outs, 1 runs, event: 3, runners: [2, 1]\n",
      "1 outs, 3 runs, event: 1, runners: [3]\n",
      "1 outs, 4 runs, event: f, runners: [1]\n",
      "2 outs, 4 runs, event: o, runners: [1]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "inning(verbose=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "And we can feed in any events we want to test the code:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 outs, 0 runs, event: 2, runners: []\n",
      "0 outs, 0 runs, event: E, runners: [2]\n",
      "0 outs, 0 runs, event: B, runners: [3, 1]\n",
      "0 outs, 0 runs, event: B, runners: [3, 2, 1]\n",
      "0 outs, 1 runs, event: 1, runners: [3, 2, 1]\n",
      "0 outs, 3 runs, event: D, runners: [2, 1]\n",
      "2 outs, 3 runs, event: B, runners: [3]\n",
      "2 outs, 3 runs, event: 1, runners: [3, 1]\n",
      "2 outs, 4 runs, event: 2, runners: [2, 1]\n",
      "2 outs, 5 runs, event: f, runners: [3, 2]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "inning('2EBB1DB12f', verbose=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "That looks good.\n",
    "\n",
    "# Simulating\n",
    "\n",
    "Now, simulate a million innings, and then sample from them to simulate a million nine-inning games (for one team):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "N = 1000000\n",
    "innings = [inning() for _ in range(N)]\n",
    "games = [sum(random.sample(innings, 9)) for _ in range(N)]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's see histograms:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEICAYAAACj2qi6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3X2UHVWZ7/Hvz4Q3BUyAnhDTgaDkqoG5RI3AjMzIgEJg8AbvQm7ijLQajY7hXhz1DgHHAQVcMKOiOIiiiSTqGLJEhgwTjRlA0bUugUYjEBBpgUBiIG0S3pQXCc/9o56GojndZ3enm9N0fp+1anXVU7t27Tp1+jxVu+qcUkRgZmZW4mWtboCZmb10OGmYmVkxJw0zMyvmpGFmZsWcNMzMrJiThpmZFXPSsGKS/kLSnUNU11clfWoo6rKRRdKZkr7R6nbY8HDSGCKS7pX0uKTHJD0g6TJJu7e6XUMpIn4aEa8doro+HBHnDEVd/ZE0RVJI+kWv+D6SnpJ073C3oRlJB0taKel3kpp+cUrSGEnnSvqtpEcl/ULSuNr8v8/34COSFknaJeP75fuzPoSkjxe288dZ/pBe8SszfiRARHw2Ij4woBeh73VK0gWSNudwgSQVLnt2tuu0XvHTMn72ULSxSRs+J+mu3E+/knRKr/kh6fe1/THik62TxtB6R0TsDkwH3gCc0eL2DJqksa1uwxB7uaSDa9PvBu5pVWN6+SOwDJhbWP7TwJ8DfwbsCbwHeAJA0rHAAuBoYH/g1VmeiLgvInbvGYA/BZ4BrhhAW38NPPvBJ2nvbEf3AOoYiHnAicAhwH8H3gF8aADLP6+9qSPjL4bfU7X5lbneL0n6815lDqntlyFJtsPJS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WAiM9adwETJV0gKSdgdnA8ha3ycxshzWiu6ci4mlJpwIrqW65XRQRa1vQlGHr+hrBvM07Bm/z6Dek2zuiL4SbmdnIMtK7p8zMbARx0jAzs2JOGk1IminpTkldkha0uj0vBkn3SrpV0hpJna1uz3CQtEjSJkm31WJ7SVol6a78O76VbRxKfWzv2ZI25H5eI+n4VrZxqEmaLOk6SbdLWivptIyP5v3c1zYP2b72NY1+5M+Y/Bp4O7Ce6m6uORExqr+RLuleYEZEjNovQEn6S+AxYElEHJyxfwa2RMT5eYAwPiJOb2U7h0of23s28FhEfK6VbRsukiYCEyPi55L2AG4GTgTey+jdz31t88kM0b72mUb/nv0Zk4h4Cuj5GRN7iYuI64EtvcKzgMU5vpjqn21U6GN7R7WI2BgRP8/xR4E7gEmM7v3c1zYPGSeN/k0C7q9Nr2eId8AIFcCPJN2cP9Gyo5gQERtz/AFgQisb8yI5VdIt2X01arppepM0BXgDsJodZD/32mYYon3tpGGNHBERb6T6deH52bWxQ4mq33a0991eArwGmA5sBD7f2uYMD0m7A1cAH42IR+rzRut+brDNQ7avnTR6JSivAAABF0lEQVT6t0P+jElEbMi/m4ArqbrpdgQPZp9wT9/wpha3Z1hFxIMRsS0ingG+zijcz5J2ovrw/E5EfD/Do3o/N9rmodzXThr92+F+xkTSK/ICGpJeARwD3Nb/UqPGcqAjxzuAq1rYlmHX88GZ3sko28+qfhN/IXBHRHyhNmvU7ue+tnko97Xvnmoib037Is/9jMl5LW7SsJL0aqqzC6h+ZubfRuM2S/oucCTVz0Y/CJwF/DuwDNgPWAecHBGj4uJxH9t7JFV3RQD3Ah+q9fW/5Ek6AvgpcCvwTIbPpOrjH637ua9tnsMQ7WsnDTMzK+buKTMzK+akYWZmxZw0zMysmJOGmZkVc9IwM7NiThpmZlbMScPMzIr9f6tPfK5QmWxEAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "def hist(nums, title): \n",
    "    \"Plot a histogram.\"\n",
    "    plt.hist(nums, ec='black', bins=max(nums)-min(nums)+1, align='left')\n",
    "    plt.title(f'{title} Mean: {sum(nums)/len(nums):.3f}, Min: {min(nums)}, Max: {max(nums)}')\n",
    "    \n",
    "hist(innings, 'Runs per inning:')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAEICAYAAAC0+DhzAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3XucHWWd5/HP13BVLgnQE0M6ITBkRWQkSgtxdUYEDQmiQQcRvBAwEEdAYXdcAS+Dw2UGHV9CmEF8ZSGSIIpZFMkywZANoLI7AZqLyEWGAIGkTZOWJFxEwOBv/3ieJsWp093ndDp9Tnd/36/XeXXVry7nqXOqz6+ep56qUkRgZmZW9IZGF8DMzJqPk4OZmZU4OZiZWYmTg5mZlTg5mJlZiZODmZmVODmY2RaR9IKkfRpdDhtYTg41kLRK0h/zP0GnpKsk7dToco1EkiZJCkn3VsT3kPSKpFUNKlqxLAdIWirp95J6vJBI0mRJL0n6QQ3r3E7Sw5LWVMRHSbpA0u8kPS/pXkmjC9P3kXRjnvZ7Sd+qcRsOzZ/z9RXxA3P8tu5YROwUEY/Xst4a3neKpLslvZj/Tqlj2ZC0TtI2hdi2ObbVL+gq7JsvFF5fL0y/Ku+jxemjtna5+svJoXYfjoidgCnAO4BzGlyefiv+8wxhb5R0QGH8k8ATjSpMhT8Bi4DZfcx3GXBXjev8H0BXlfg/Av8VeDewC/AZ4CVICQVYBtwCvBloBfpMRAVdwLsl7V6IzQL+s4511CyX9wZSGccAC4AbcrxWG4AZhfEZ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R988f544aQ5KkUZLulXRjHh9O27ZK0m8k3SepPceG/H4JIzQ5FG7XMQPYHzhe0v6NLdUWuwqYXhE7G1geEZOB5Xl8KNoE/H1E7A9MBU7L39dw2L6XgcMi4kBgCjBd0lTgm8DFEbEvsAGY3cAybqkzgIcL48Np2wDeHxFTCtc3DIf9cmQmBwq364iIV4Du23UMWRHxS2B9RXgmsCAPLwCOHtRCDZCIWBsR9+Th50k/NOMZBtsXyQt5dNv8CuAw4LocH5LbBiCpFfgQcEUeF8Nk23ox5PdLGLnJYTxQvLnSmhwbbsZGxNo83AmMbWRhBoKkScA7gDsYJtuXm13uA9YBy4DHgI0RsSnPMpT3z0uALwN/zuO7M3y2DVIiv1nS3fn2PjBM9sumuM7Btr6ICElDut+ypJ2AnwBnRsRzxZvADeXti4hXgSmSRgPXA/s1uEgDQtJRwLqIuFvSoY0uz1by3ojokPQXwDJJvy1OHMr75UitOYyU23U8LWkcQP67rsHl6TdJ25ISwzUR8dMcHjbbBxARG4FbgXcDoyV1H7wN1f3zPcBHJK0iNd0eRnpmy3DYNgAioiP/XUdK7AczTPbLkZocRsrtOhYDs/LwLOCGBpal33I79ZXAwxHxncKkIb99kloPmeYEAAAA5ElEQVRyjQFJO5KeafIwKUkck2cbktsWEedERGtETCL9j90SEZ9iGGwbgKQ3Sdq5exiYBjzAMNgvYQRfIS3pSFJ7aPftOi5scJG2iKQfAYeSbhn8NHAu8DNgETAReBI4NiIqT1o3PUnvBX4F/IbNbddfIZ13GNLbJ+ntpJOWo0gHa4si4jxJ+5COtncD7gU+HREvN66kWyY3K30pIo4aLtuWt+P6PLoN8MOIuFDS7gzx/RJGcHIwM7OejdRmJTMz64WTg5mZlTg5mJlZiZODmZmVODmYmVmJk4OZmZU4OZiZWcn/B6reEkoQ/MFpAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "hist(games, 'Runs per game:')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
